The present disclosure relates in general to array index computations, and more specifically to reducing the overhead required to perform array index computations.
The simplest type of data structure in computer architecture is a linear array, which consists of a collection of elements (or values, or variables) each identified by at least one array index. A programmer locates and accesses a particular array element by knowing an address that identifies where the start of the particular array is located in memory, along with the index, which identifies how far from the array start address the element is actually located. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula. For example, an array of 10 32-bit integer variables, with indices 0 through 9, may be stored as 10 words at memory addresses 2000, 2004, 2008, . . . 2036, so that the element with index i has the address 2000+4×i. This operation is known generally as an array index computation.
For a variety of reasons, 64-bit servers must be able to execute 32-bit applications. This means that for a 32-bit application running on a 64-bit server, the array memory locations are 64-bits while the indices are 32-bits. The disparity between data types and address widths typically requires multiple step adjustments to a 32-bit application-generated index in order to perform an array index computation on a 64-bit server. Implementing the multiple adjustments to 32-bit indices typically requires multiple additional code instructions, thereby increasing programming overhead and potentially having a negative impact on application performance, particularly for large data sets.